import Vue from 'vue'
import VueRouter from 'vue-router'

import Find from '@/views/Find.vue'
import Rock from '@/views/Seconds/Rock'
import Popluar from '@/views/Seconds/Popluar'
import Classic from '@/views/Seconds/Classic'

import My from '@/views/My.vue'
import Friend from '@/views/Friend.vue'
import NotFound from '@/views/NotFound.vue'

import Layout from '@/views/Layout'
import Detail from '@/views/detail.vue'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect: '/find',
    },

    {
      name: 'layout',
      path: '/layout',
      component: Layout,
    },

    {
      name: 'detail',
      path: '/detail',
      component: Detail,
    },

    {
      name: 'find',
      path: '/find',
      component: Find,
      //配置二级路由规则
      children: [
        {
          name: 'rock',
          path: 'rock',
          component: Rock,
        },
        {
          name: 'popluar',
          path: 'popluar',
          component: Popluar,
        },
        {
          name: 'classic',
          path: 'classic',
          component: Classic,
        },
      ],
    },
    {
      name: 'my',
      path: '/my',
      component: My,
    },
    {
      name: 'part',
      path: '/part',
      component: Friend,
    },
    {
      path: '/part/:username/:password',
      component: Friend,
    },
    {
      path: '*',
      component: NotFound,
    },
  ],
})

export default router
